package com.spica.platform.user.service.impl;

import com.spica.platform.base.model.SysMenu;
import com.spica.platform.db.service.impl.ServiceImpl;
import com.spica.platform.user.mapper.SysRoleMenuMapper;
import com.spica.platform.user.model.SysRoleMenu;
import com.spica.platform.user.service.ISysRoleMenuService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Set;

@Slf4j
@Service
public class SysRoleMenuServiceImpl extends ServiceImpl<SysRoleMenuMapper, SysRoleMenu> implements ISysRoleMenuService {
	@Resource
	private SysRoleMenuMapper sysRoleMenuMapper;

	@Override
	public List<SysMenu> findSysMenusByRoleIds(Set<Long> roleIds, Integer type) {
		return sysRoleMenuMapper.selectSysMenusByRoleIds(roleIds, type);
	}

	@Override
	public List<SysMenu> findSysMenusByRoleCodes(Set<String> roleCodes, Integer type) {
		return sysRoleMenuMapper.selectSysMenusByRoleCodes(roleCodes, type);
	}

	@Override
	public int remove(Long roleId, Long menuId) {
		return sysRoleMenuMapper.delete(roleId, menuId);
	}
}
